/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;

import MYSQLConection.OperacionesDB;
import java.sql.ResultSet;
import java.sql.SQLException;
import negocio.Admin;
import negocio.Admin;
import negocio.Usuario;

/**
 *
 * @author Adrian
 */
public class DaoAdministrador {
    private static DaoAdministrador instance;

    private DaoAdministrador() {
    }

    public static DaoAdministrador getInstance() {
        if (instance == null) {
            return instance = new DaoAdministrador();
        }
        return instance;
    }
    public Admin Logeo(String cedula, String contrasena) throws SQLException
    { 
        OperacionesDB db = new OperacionesDB();
        String query="Select * from administrador where cedula='"+cedula+"'"+"and contrasena='"+contrasena+"'";
         ResultSet resultado=db.seleccion(query);
         Admin user=null; 
        while (resultado.next()) {
           
          user = new Admin(resultado.getString(1),resultado.getString(2),resultado.getString(4),resultado.getString(5));
            
        }
         db.cerrarConexion();
        
        return user;
        
    }
}
